import com.lbi.animation.single.Animation;
import com.lbi.core.helper.Delegate;

import asunit.framework.TestCase;

/**
 * @author micfor
 */
class animation.AnimationTest extends TestCase {
	private var className : String = "AnimationTest";
	private var animation : Animation;

	private var START_VALUE : Number = 0;
	private var END_VALUE : Number = 1;
	private var FRAMES : Number = 5;
	private var EXPECTED_INCREMENT : Number = (END_VALUE - START_VALUE) / FRAMES; 
	
	private var count:Number = 0;
	
	public function run():Void{
		count = 0;
		animation = new Animation(this,animationEnterFrame,START_VALUE,END_VALUE,FRAMES);
		animation.addEventListener("complete",Delegate.create(super, super.run));
		animation.go();	
	}
	
	private function animationEnterFrame(n:Number):Void{
		count++;
		assertEquals(EXPECTED_INCREMENT * count, n);
	}
	
}